<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
    <title>Preskool - Subject</title>

    <!-- Favicon -->
    <link rel="shortcut icon" href="assets/img/favicon.png">

    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,500;0,600;0,700;1,400&display=swap">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">

    <!-- Fontawesome CSS -->
    <link rel="stylesheet" href="assets/plugins/fontawesome/css/fontawesome.min.css">
    <link rel="stylesheet" href="assets/plugins/fontawesome/css/all.min.css">

    <!-- Main CSS -->
    <link rel="stylesheet" href="assets/css/style.css">
</head>
<body>

<!-- Main Wrapper -->
<div class="main-wrapper">

    <!-- Header -->
    <!--页面头部 -->
    <div class="header">

        <!-- Logo -->
        <div class="header-left">
            <a href="index.html" class="logo">
                <img src="assets/img/logo.png" alt="Logo">
            </a>
            <a href="index.html" class="logo logo-small">
                <img src="assets/img/logo-small.png" alt="Logo" width="30" height="30">
            </a>
        </div>
        <!-- /Logo -->

        <a href="javascript:void(0);" id="toggle_btn">
            <i class="fas fa-align-left"></i>
        </a>

        <!-- Search Bar -->
        <div class="top-nav-search">
            <form>
                <input type="text" class="form-control" placeholder="搜索">
                <button class="btn" type="submit"><i class="fas fa-search"></i></button>
            </form>
        </div>
        <!-- /Search Bar -->

        <!-- Mobile Menu Toggle -->
        <a class="mobile_btn" id="mobile_btn">
            <i class="fas fa-bars"></i>
        </a>
        <!-- /Mobile Menu Toggle -->

        <!-- Header Right Menu -->
        <ul class="nav user-menu">

            <!-- Notifications -->
            <li class="nav-item dropdown noti-dropdown">
                <a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown">
                    <i class="far fa-bell"></i> <span class="badge badge-pill">3</span>
                </a>
                <div class="dropdown-menu notifications">
                    <div class="topnav-dropdown-header">
                        <span class="notification-title">通知</span>
                        <a href="javascript:void(0)" class="clear-noti"> 清除</a>
                    </div>
                    <div class="noti-content">
                        <ul class="notification-list">
                            <li class="notification-message">
                                <a href="#">
                                    <div class="media">
												<span class="avatar avatar-sm">
													<img class="avatar-img rounded-circle" alt="User Image" src="assets/img/profiles/avatar-02.jpg">
												</span>
                                        <div class="media-body">
                                            <p class="noti-details"><span class="noti-title">Carlson Tech</span> has approved <span class="noti-title">your estimate</span></p>
                                            <p class="noti-time"><span class="notification-time">4 mins ago</span></p>
                                        </div>
                                    </div>
                                </a>
                            </li>
                            <li class="notification-message">
                                <a href="#">
                                    <div class="media">
												<span class="avatar avatar-sm">
													<img class="avatar-img rounded-circle" alt="User Image" src="assets/img/profiles/avatar-11.jpg">
												</span>
                                        <div class="media-body">
                                            <p class="noti-details"><span class="noti-title">International Software Inc</span> has sent you a invoice in the amount of <span class="noti-title">$218</span></p>
                                            <p class="noti-time"><span class="notification-time">6 mins ago</span></p>
                                        </div>
                                    </div>
                                </a>
                            </li>
                            <li class="notification-message">
                                <a href="#">
                                    <div class="media">
												<span class="avatar avatar-sm">
													<img class="avatar-img rounded-circle" alt="User Image" src="assets/img/profiles/avatar-17.jpg">
												</span>
                                        <div class="media-body">
                                            <p class="noti-details"><span class="noti-title">John Hendry</span> sent a cancellation request <span class="noti-title">Apple iPhone XR</span></p>
                                            <p class="noti-time"><span class="notification-time">8 mins ago</span></p>
                                        </div>
                                    </div>
                                </a>
                            </li>
                            <li class="notification-message">
                                <a href="#">
                                    <div class="media">
												<span class="avatar avatar-sm">
													<img class="avatar-img rounded-circle" alt="User Image" src="assets/img/profiles/avatar-13.jpg">
												</span>
                                        <div class="media-body">
                                            <p class="noti-details"><span class="noti-title">Mercury Software Inc</span> added a new product <span class="noti-title">Apple MacBook Pro</span></p>
                                            <p class="noti-time"><span class="notification-time">12 mins ago</span></p>
                                        </div>
                                    </div>
                                </a>
                            </li>
                        </ul>
                    </div>
                    <div class="topnav-dropdown-footer">
                        <a href="#">View all Notifications</a>
                    </div>
                </div>
            </li>
            <!-- /Notifications -->

            <!-- User Menu -->
            <li class="nav-item dropdown has-arrow">
                <a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown">
                    <span class="user-img"><img class="rounded-circle" src="assets/img/profiles/avatar-01.jpg" width="31" alt="Ryan Taylor"></span>
                </a>
                <div class="dropdown-menu">
                    <div class="user-header">
                        <div class="avatar avatar-sm">
                            <img src="assets/img/profiles/avatar-01.jpg" alt="User Image" class="avatar-img rounded-circle">
                        </div>
                        <div class="user-text">
                            <h6>Ryan Taylor</h6>
                            <p class="text-muted mb-0">Administrator</p>
                        </div>
                    </div>
                    <a class="dropdown-item" href="profile.html">我的资料</a>
                    <a class="dropdown-item" href="inbox.html">邮箱</a>
                    <a class="dropdown-item" href="../log/login.html">注销</a>
                </div>
            </li>
            <!-- /User Menu -->

        </ul>
        <!-- /Header Right Menu -->

    </div>
    <!-- /Header -->

    <!-- Sidebar -->
    <div class="sidebar" id="sidebar">
        <div class="sidebar-inner slimscroll">
            <div id="sidebar-menu" class="sidebar-menu">
                <ul>
                    <li class="menu-title">
                        <span>主菜单</span>
                    </li>
                    <li >
                        <a href="index.html"><i class="fas fa-th-large"></i> <span>首页</span></a>
                    </li>
                    <li class="submenu">
                        <a href="#"><i class="fas fa-user-graduate"></i> <span> 学生管理</span> <span class="menu-arrow"></span></a>
                        <ul>
                            <li><a href="students.jsp">查看所有学生</a></li>
<!--                            <li><a href="student-details.jsp">查看学生详情</a></li>-->
<!--                            <li><a href="add-student.html">添加学生信息</a></li>-->
<!--                            <li><a href="edit-student.jsp">修改学生信息</a></li>-->
                        </ul>
                    </li>
                    <li>
                        <a href="#"><i class="fas fa-chalkboard-teacher"></i> <span> 教师管理</span> <span class="menu-arrow"></span></a>
                        <ul>
                            <li><a href="teachers.jsp" >查看所有教师</a></li>
<!--                            <li><a href="teacher-details.jsp">查看教师详情</a></li>-->
<!--                            <li><a href="add-teacher.html" class="active">添加教师信息</a></li>-->
<!--                            <li><a href="edit-teacher.jsp">修改教师信息</a></li>-->
                        </ul>
                    </li>
<!--                    <li class="submenu">-->
<!--                        <a href="#"><i class="fas fa-building"></i> <span> 院系管理</span> <span class="menu-arrow"></span></a>-->
<!--                        <ul>-->
<!--                            <li><a href="departments.html" class="active">查看所有院系</a></li>-->
<!--                            <li><a href="add-department.html">添加院系信息</a></li>-->
<!--                            <li><a href="edit-department.html">修改院系信息</a></li>-->
<!--                        </ul>-->
<!--                    </li>-->
                    <li class="submenu ">
                        <a href="#"><i class="fas fa-book-reader"></i> <span> 课程管理</span> <span class="menu-arrow"></span></a>
                        <ul>
                            <li><a href="subjects.jsp" >查看所有课程</a></li>
<!--                            <li><a href="add-subject.jsp">添加课程信息</a></li>-->
<!--                            <li><a href="edit-subject.jsp">修改课程信息</a></li>-->
                        </ul>
                    </li>
<!--                    <li class="submenu">-->
<!--                        <a href="#"><i class="fas fa-user-graduate"></i> <span> 班级管理</span> <span class="menu-arrow"></span></a>-->
<!--                        <ul>-->
<!--                            <li><a href="clazz.html">查看所有班级</a></li>-->
<!--                            <li><a href="add-clazz.html">添加班级信息</a></li>-->
<!--                            <li><a href="edit-clazz.html">修改班级信息</a></li>-->
<!--                        </ul>-->
<!--                    </li>-->
<!--                    <li class="submenu">-->
<!--                        <a href="#"><i class="fas fa-building"></i> <span> 专业管理</span> <span class="menu-arrow"></span></a>-->
<!--                        <ul>-->
<!--                            <li><a href="major.html">查看所有专业</a></li>-->
<!--                            <li><a href="add-major.html">添加专业信息</a></li>-->
<!--                            <li><a href="edit-major.html">修改专业信息</a></li>-->
<!--                        </ul>-->
<!--                    </li>-->
<!--                    <li class="submenu">-->
<!--                        <a href="#"><i class="fas fa-chalkboard-teacher"></i> <span> 选课管理</span> <span class="menu-arrow"></span></a>-->
<!--                        <ul>-->
<!--                            <li><a href="course.html">查看所有选修课</a></li>-->
<!--                            <li><a href="add-course.html">添加选修课信息</a></li>-->
<!--                            <li><a href="edit-course.html">修改选修课信息</a></li>-->
<!--                        </ul>-->
<!--                    </li>-->

                    <li class="submenu active">
                        <a href="#"><i class="fas fa-chalkboard-teacher"></i> <span>课程表管理</span> <span class="menu-arrow"></span></a>
                        <ul>
                            <li><a href="quall-class-schedule.jsp">查看课程表信息</a></li>
<!--                            <li><a href="add-class-schedue.html" class="active">添加课程表信息</a></li>-->
<!--                            <li><a href="edit-class-schedule.html">修改课程表信息</a></li>-->
                        </ul>
                    </li>

                </ul>
            </div>
        </div>
    </div>
    <!-- /Sidebar -->

    <!-- Page Wrapper -->
    <div class="page-wrapper">
        <div class="content container-fluid">

            <!-- Page Header -->
            <div class="page-header">
                <div class="row align-items-center">
                    <div class="col">
                        <h3 class="page-title">添加课程表</h3>
                        <ul class="breadcrumb">
                            <li class="breadcrumb-item"><a href="quall-class-schedule.jsp">课程表列表</a></li>
                            <li class="breadcrumb-item active">添加课程表信息</li>
                        </ul>
                    </div>
                </div>
            </div>
            <!-- /Page Header -->

            <div class="row">
                <div class="col-sm-12">

                    <div class="card">
                        <div class="card-body">
                            <form>
                                <div class="row">
                                    <div class="col-12">
                                        <h5 class="form-title"><span>课程表信息</span></h5>
                                    </div>

                                    <div class="col-12 col-sm-6">
                                        <div class="form-group">
                                            <label>周几</label>
<!--                                            <input type="text" class="form-control">-->
                                            <select class="form-control" name="whichDay01" id="whichDay01">
                                                <option>选择周几</option>
                                                <option>周一</option>
                                                <option>周二</option>
                                                <option>周三</option>
                                                <option>周四</option>
                                                <option>周五</option>
                                                <option>周六</option>
                                                <option>周末</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-12 col-sm-6">
                                        <div class="form-group">
                                            <label>上课开始时间</label>
                                            <select class="form-control" name="startingTime" id="startingTime">
                                                <option>选择时间</option>
                                                <option>8:00</option>
                                                <option>10:00</option>
                                                <option>14:00</option>
                                                <option>15:50</option>
                                                <option>18:00</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-12 col-sm-6">
                                        <div class="form-group">
                                            <label>上课结束时间</label>
                                            <select class="form-control" name="endTime" id="endTime">
                                                <option>选择时间</option>
                                                <option>9:40</option>
                                                <option>11:45</option>
                                                <option>15:40</option>
                                                <option>17:25</option>
                                                <option>19:40</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-12 col-sm-6">
                                        <div class="form-group">
                                            <label>是否单双周</label>
                                            <select class="form-control" name="singleAndDoubleWeek" id="singleAndDoubleWeek">
                                                <option>选择是否单双周</option>
                                                <option>是</option>
                                                <option>否</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-12 col-sm-6">
                                        <div class="form-group">
                                            <label>几周课时</label>
                                            <input type="text" class="form-control" id="timeOfDuration" name="timeOfDuration">
                                        </div>
                                    </div>
                                    <div class="col-12 col-sm-6">
                                        <div class="form-group">
                                            <label>任课教师</label>
                                            <select class="form-control" name="teacherId" id="teacherId" >
                                                <option>选择教师工号</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-12 col-sm-6">
                                        <div class="form-group">
                                            <label>上课地点</label>
                                            <input type="text" class="form-control" id="placeOfClass" name="placeOfClass">
                                        </div>
                                    </div>
                                    <div class="col-12 col-sm-6">
                                        <div class="form-group">
                                            <label>课程名称</label>
                                            <select class="form-control" name="courseid" id="courseid">
                                                <option>选择课程编号</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-12 col-sm-6">
                                        <div class="form-group">
                                            <label>学期开始时间</label>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <span id="curriculumTimeSpan" ></span>
                                            <div>
                                                <input type="date" class="form-control" name="curriculumTime" id="curriculumTime">
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-12 col-sm-6">
                                        <div class="form-group">
                                            <label>学期结束时间</label>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <span id="courseEndTimeSpan" ></span>
                                            <div>
                                                <input type="date" class="form-control" name="courseEndTime" id="courseEndTime">
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-12 col-sm-6" id="attendClassObjects">
                                        <div class="form-group">
                                            <label>开课对象</label>
                                            <select class="form-control" name="attendClassObject" id="attendClassObject">
                                                <option>选择大几学生</option>
                                                <option>大一</option>
                                                <option>大二</option>
                                                <option>大三</option>
                                                <option>大四</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-12 col-sm-6" id="stidentmajors">
                                        <div class="form-group">
                                            <label>专业</label>
                                            <select class="form-control" name="stidentmajor" id="stidentmajor">
                                                <option>请选择专业</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-12">
                                        <button type="button" class="btn btn-primary" id="submit01">提交</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>

                </div>
            </div>
        </div>

    </div>
    <!-- /Page Wrapper -->

</div>
<!-- /Main Wrapper -->

<!-- jQuery -->
<script src="assets/js/jquery-3.5.1.min.js"></script>

<!-- Bootstrap Core JS -->
<script src="assets/js/popper.min.js"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>

<!-- Slimscroll JS -->
<script src="assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>

<!-- Custom JS -->
<script src="assets/js/script.js"></script>
<script src="../../js/sweetalert.min.js" type="text/javascript"></script>

<script>


      var s=null;

      var falg=null;

    //查询教师编号
    function queryAllTeachersworknumber() {
        $.ajax({
            //接收路径
            url: './ClassSchedule.do',
            type: 'POST',
            dataType: 'text',
            data: {
                action:'queryAllTeachersworknumber'
            },
            success:function (data) {//响应成功获取响应返回的值

                var parse = JSON.parse(data);

                if ( parse.length!==0){
                    //data:服务器响应的数据
                    var li="<option>选择教师工号</option>";
                    for (var i = 0; i <parse.length ; i++) {//回填到table当中去
                        li +="<option>"+parse[i].teacherid+"</option>"
                    }
                    if (li==="<option>选择教师工号</option>"){
                        swal({
                            title : "查询提示提示",
                            type : "error",
                            text : "未找到用户信息01",
                            confirmButtonText : "确定",
                            closeOnConfirm : false
                        })
                    }
                    $('#teacherId').html(li);
                }else {
                    swal({
                        title : "查询提示提示",
                        type : "error",
                        text : "暂无教师",
                        confirmButtonText : "确定",
                        closeOnConfirm : false
                    })
                }
            },error: function (err) {  //响应失败
                swal({
                    title : "查教师编号提示信息",
                    type : "error",
                    text : "查询教师编号失败",
                    confirmButtonText : "确定",
                    closeOnConfirm : false
                });

            }
        });
    }


     //课程编号
    function queryAllcourse() {
        $.ajax({
            //接收路径
            url: './ClassSchedule.do',
            type: 'POST',
            dataType: 'text',
            data: {
                action:'queryAllcourse'
            },
            success:function (data) {//响应成功获取响应返回的值

                var parse = JSON.parse(data);
                   s=parse;
                if ( parse.length!==0){
                    //data:服务器响应的数据
                    var li="<option>选择课程号</option>";
                    for (var i = 0; i <parse.length ; i++) {//回填到table当中去
                        li +="<option>"+parse[i].courseid+"</option>"
                    }
                    if (li==="<option>选择课程号</option>"){
                        swal({
                            title : "查询提示提示",
                            type : "error",
                            text : "未找到课程信息",
                            confirmButtonText : "确定",
                            closeOnConfirm : false
                        })
                    }
                    $('#courseid').html(li);
                }else {
                    swal({
                        title : "查询提示提示",
                        type : "error",
                        text : "暂无课程",
                        confirmButtonText : "确定",
                        closeOnConfirm : false
                    })
                }
            },error: function (err) {  //响应失败
                swal({
                    title : "查课程编号提示信息",
                    type : "error",
                    text : "查询课程编号失败",
                    confirmButtonText : "确定",
                    closeOnConfirm : false
                });

            }
        });
    }




      //专业
      function queryAllMajor() {
          $.ajax({
              //接收路径
              url: './ClassSchedule.do',
              type: 'POST',
              dataType: 'text',
              data: {
                  action:'queryAllMajor'
              },
              success:function (data) {//响应成功获取响应返回的值
                  var parse = JSON.parse(data);
                  if ( parse.length!==0){
                      //data:服务器响应的数据
                      var li="<option>请选择专业</option>";
                      for (var i = 0; i <parse.length ; i++) {//回填到table当中去
                          li +="<option>"+parse[i].major+"</option>"
                      }
                      if (li==="<option>请选择专业</option>"){
                          swal({
                              title : "查询提示提示",
                              type : "error",
                              text : "专业信息",
                              confirmButtonText : "确定",
                              closeOnConfirm : false
                          })
                      }
                      $('#stidentmajor').html(li);
                  }else {
                      swal({
                          title : "查询提示提示",
                          type : "error",
                          text : "暂无专业",
                          confirmButtonText : "确定",
                          closeOnConfirm : false
                      })
                  }
              },error: function (err) {  //响应失败
                  swal({
                      title : "查询提示信息",
                      type : "error",
                      text : "查询专业失败",
                      confirmButtonText : "确定",
                      closeOnConfirm : false
                  });

              }
          });
      }




    //判断当前是选修还是必修课类型
    $("#courseid").change(function () {
        var pagSize=$("#courseid").val();
        for (var i=0;i<s.length;i++){
            if (s[i].courseid==pagSize){
                if (s[i].type=="选修课"){
                    $('#attendClassObjects').hide();
                    $('#stidentmajors').hide();
                    falg=1;
                }else {
                    $('#attendClassObjects').show();
                    $('#stidentmajors').show();
                    falg=0;
                }
            }
        }
    });


    //准备添加
    //首先需要进行简单过滤
      //失去焦点时自动匹配正确规范的课时
      $('#timeOfDuration').blur(function () {
          var name= $('#timeOfDuration').val()
          var namePatt=/^[1-9][0-9]{1}$/;

          if (!namePatt.test(name)){
              swal({
                  title : "课时验证提示",
                  type : "error",
                  text : "姓名格式不正确",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              });
          }

          if (name<12 || name>48){
              swal({
                  title : "课时验证提示",
                  type : "error",
                  text : "课时不能小于12，大于48",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              });
          }
      })


      //上课地点验证
      $('#placeOfClass').blur(function () {
          var name= $('#placeOfClass').val()
          var namePatt=/^([\u4e00-\u9fa5]+|([a-zA-Z]+\s?)+)$/;

          if (!namePatt.test(name)){
              swal({
                  title : "上课地点验证提示",
                  type : "error",
                  text : "上课地点填写格式不正确",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              });
          }
      })

      //学期开始时间
      $('#curriculumTime').blur(function () {
          var name= $('#curriculumTime').val()

          var date = new Date();

          var d = new Date(date);
          var datetime =  d.getFullYear() + "-0" + (d.getMonth() + 1) + "-" + d.getDate();
          if (name<datetime){
              swal({
                  title : "学期时间验证提示",
                  type : "error",
                  text : "学期开始时间不能小于当前时间",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              });
          }
      })


      //学期结束时间
      $('#courseEndTime').blur(function () {
          var name= $('#courseEndTime').val()

          var name01= $('#curriculumTime').val()

          if (name01>name){
              swal({
                  title : "学期时间提示",
                  type : "error",
                  text : "学期结束时间不能小于开始时间",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              });
          }
      })





      //添加
      $('#submit01').click(function () {

         var  whichDay01=$('#whichDay01').val();
         var  startingTime=$('#startingTime').val();
         var  endTime=$('#endTime').val();
         var  singleAndDoubleWeek=$('#singleAndDoubleWeek').val();
         var  timeOfDuration=$('#timeOfDuration').val();
         var  teacherId=$('#teacherId').val();
         var  placeOfClass=$('#placeOfClass').val();
         var  courseid=$('#courseid').val();
         var  curriculumTime=$('#curriculumTime').val();
         var  courseEndTime=$('#courseEndTime').val();
         var  attendClassObject=$('#attendClassObject').val();
         var  stidentmajor=$('#stidentmajor').val();


          var date = new Date();

          var d = new Date(date);
          var datetime =  d.getFullYear() + "-0" + (d.getMonth() + 1) + "-" + d.getDate();

          if (curriculumTime<datetime){
              swal({
                  title : "学期时间验证提示",
                  type : "error",
                  text : "学期开始时间不能小于当前时间",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              });
              return false;
          }



          if (falg==1){
              attendClassObject="1"
              stidentmajor="1";
          }else {

              if (attendClassObject=="选择大几学生"){
                  swal({
                      title : "查询提示提示",
                      type : "error",
                      text : "未选择大几学生信息",
                      confirmButtonText : "确定",
                      closeOnConfirm : false
                  })

                  return false;
              }


              if (stidentmajor=="请选择专业"){
                  swal({
                      title : "查询提示提示",
                      type : "error",
                      text : "未选择专业信息",
                      confirmButtonText : "确定",
                      closeOnConfirm : false
                  })

                  return false;
              }


          }

          if (courseid=="选择课程号"){
              swal({
                  title : "查询提示提示",
                  type : "error",
                  text : "未选择课程信息",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              })

              return false;
          }

          if (teacherId=="选择教师工号"){

              swal({
                  title : "查询提示提示",
                  type : "error",
                  text : "未选择授课教师信息",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              })

              return false;
          }

          if (singleAndDoubleWeek=="选择是否单双周"){

              swal({
                  title : "查询提示提示",
                  type : "error",
                  text : "未选择是否单周信息",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              })
              return false;
          }


          if (endTime=="选择时间"){

              swal({
                  title : "查询提示提示",
                  type : "error",
                  text : "未选择上课结束时间信息",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              })
              return false;
          }


          if (startingTime=="选择时间"){

              swal({
                  title : "查询提示提示",
                  type : "error",
                  text : "未选择上课开始时间信息",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              })
              return false;
          }


          if (whichDay01=="选择周几"){

              swal({
                  title : "查询提示提示",
                  type : "error",
                  text : "未选择周几上课信息",
                  confirmButtonText : "确定",
                  closeOnConfirm : false
              })
              return false;
          }

          $.ajax({
              //接收路径
              url: './ClassSchedule.do',
              type: 'POST',
              dataType: 'text',
              data: {
                  whichDay01:whichDay01,
                  startingTime:startingTime,
                  endTime:endTime,
                  singleAndDoubleWeek:singleAndDoubleWeek,
                  timeOfDuration:timeOfDuration,
                  teacherId:teacherId,
                  placeOfClass:placeOfClass,
                  courseid:courseid,
                  curriculumTime:curriculumTime,
                  courseEndTime:courseEndTime,
                  attendClassObject:attendClassObject,
                  stidentmajor:stidentmajor,
                  action:'addClassSchedule'
              },
              success:function (data) {//响应成功获取响应返回的值

                  if (data=="0"){
                      swal({
                          title : "课程表添加提示",
                          type : "error",
                          text : "选课程表添加成功",
                          confirmButtonText : "确定",
                          closeOnConfirm : false
                      })
                  }else if(data=="1"){
                      swal({
                          title : "课程表添加提示",
                          type : "error",
                          text : "选课程表添加失败",
                          confirmButtonText : "确定",
                          closeOnConfirm : false
                      })
                  }else if(data=="2"){
                      swal({
                          title : "课程表添加提示",
                          type : "error",
                          text : "必修课程表添加成功",
                          confirmButtonText : "确定",
                          closeOnConfirm : false
                      })
                  }else if(data=="3"){
                      swal({
                          title : "课程表添加提示",
                          type : "error",
                          text : "必修课程表添加失败",
                          confirmButtonText : "确定",
                          closeOnConfirm : false
                      })
                  }
              },error: function (err) {  //响应失败
                  swal({
                      title : "课程表添加提示",
                      type : "error",
                      text : "课程表添加失败",
                      confirmButtonText : "确定",
                      closeOnConfirm : false
                  });

              }
          });

      })










    //查询教师编号
    queryAllTeachersworknumber();
    //查看课程编号
    queryAllcourse();
    //查询专业
      queryAllMajor();


</script>
</body>
</html>